<?php
require_once 'dmp.php';
$viejo = "es la pruebaaaa y  ?";
$nuevo = "es la prueba y que señores ?";


$d = new diff_match_patch();

//var_dump($d->diff_main($viejo, $nuevo))[0];
$res = $d->diff_main($viejo, $nuevo);
//var_dump($res);

foreach ($res as $key => $value) {
    if($value[0] == 0) {
        echo $value[1];
    }
    if($value[0] == 1) {
        echo "<span style='background-color: greenyellow;'>".$value[1]."</span>";
    }
    if($value[0] == -1) {
        echo "<strike><span style='background-color: lightsalmon;'>".$value[1]."</span></strike>";
    }
}
?>